package com.swak.frame.dto;

import java.util.List;
import java.util.Optional;

import com.google.common.collect.Lists;

/**
 * @FileName Pagination.java
 * @author colley
 * @param <T>
 */
public class Pagination<T> extends PageInfo {
	private static final long serialVersionUID = 2655888519198509118L;
	private List<T> rows;

	public Pagination() {
	}

	public Pagination(int pageIndex, int pageSize) {
		super(pageIndex, pageSize);
	}

	public Pagination(List<T> rows, int totalCount, int pageSize, int pageIndex) {
		super(pageIndex, pageSize);
		this.rows = rows;
		super.totalRows = totalCount;
	}

	public List<T> getRows() {
		return Optional.ofNullable(rows).orElse(Lists.newArrayList());
	}

	public void setRows(List<T> rows) {
		this.rows = rows;
	}
}
